import request from '@/utils/request'

export function fetchMarketApiList(data) {
  return request({
    url: '/system/MarketApi/MarketApi/list',
    method: 'post',
    data
  })
}

export function getMarketApi(id) {
  return request({
    url: '/system/MarketApi/MarketApi/detail/' + id,
    method: 'get'
  })
}

export function createMarketApi(data) {
  return request({
    url: '/system/MarketApi/MarketApi/add',
    method: 'post',
    data
  })
}

export function sqlParse(data) {
  return request({
    url: '/system/MarketApi/MarketApi/sql/parse',
    method: 'post',
    data: data
  })
}

export function updateMarketApi(data) {
  return request({
    url: '/system/MarketApi/MarketApi/update',
    method: 'post',
    data
  })
}

export function deleteMarketApi(ids) {
  return request({
    url: '/system/MarketApi/MarketApi/delete',
    method: 'post',
    data: { ids }
  })
}

export function pushMarketApi(id) {
  return request({
    url: '/system/MarketApi/MarketApi/pushApi/' + id,
    method: 'post'
  })
}

export function cancelMarketApi(id) {
  return request({
    url: '/system/MarketApi/MarketApi/cancelApi/' + id,
    method: 'post'
  })
}

export function exportMarketApi(ids) {
  return request({
    url: '/system/MarketApi/MarketApi/export',
    method: 'post',
    data: { ids }
  })
}

export function getMarketApiDetail(id) {
  return request({
    url: '/system/MarketApi/MarketApi/detail1/' + id,
    method: 'get',
  })
}

export function word(id) {
  return request({
    url: '/system/MarketApi/MarketApi/word/' + id,
    method: 'post',
    responseType: 'blob'
  })
}

export function getApiCall(url, header, data) {
  return request({
    url: url,
    method: 'get',
    headers: header,
    params: data
  })
}
export function getUse(data) {
  return request({
    url: '/system/MarketApi/MarketApi/use',
    method: 'post',
    data
  })
}
